//
//  XS_Animation.swift
//  EKLWisdom
//
//  Created by 韩云智 on 2020/6/10.
//  Copyright © 2020 韩云智. All rights reserved.
//

import UIKit

public extension CAPropertyAnimation {
    /// KeyPath
    public enum XS_KeyPath: String {
        /// 平移
        case translation    = "transform.translation"
        /// 缩放
        case scale          = "transform.scale"
        /// 旋转
        case rotation       = "transform.rotation"
        /// 透明度
        case opacity        = "opacity"
        /// 位置
        case position       = "position"
        /// 圆角
        case cornerRadius   = "cornerRadius"
        
        case backgroundColor = "backgroundColor"
        case borderWidth = "borderWidth"
        case borderColor = "borderColor"
        case bounds = "bounds"
        case frame = "frame"
        case hidden = "hidden"
        case masksToBounds = "masksToBounds"
        case shadowColor = "shadowColor"
        case shadowOffset = "shadowOffset"
        case shadowOpacity = "shadowOpacity"
        case shadowRadius = "shadowRadius"
        case path = "path"
    }
    static func getAnimation(_ keyPath: XS_KeyPath, suf: String? = nil) -> Self {
        guard let suf = suf else { return getAnimation(keyPath: keyPath.rawValue) }
        return getAnimation(keyPath: keyPath.rawValue + "." + suf)
    }
    static func getAnimation(keyPath: String) -> Self {
        return self.init(keyPath: keyPath)
    }
}
